//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System.Collections;

using CommunityServer.Components;

namespace CommunityServer.Blogs.Components
{
	/// <summary>
	/// Generates an XML feed for specific tag(s)
	/// </summary>
	public class WeblogTagsRssWriter : WeblogRssWriter
	{

		protected string[] Tags = null;
		protected string Description = string.Empty;
		
		public WeblogTagsRssWriter(ArrayList posts, Weblog w, string baseUrl, string[] tags):base(posts, w, baseUrl)
		{
			Tags = tags;
			Description = string.Format("{0}: {1}", ResourceManager.GetString("Tags"), string.Join(", ", Tags));
		}

		/// <summary>
		/// Appends the Tag names to Title element
		/// </summary>
		protected override string Title
		{
			get
			{
				return string.Concat(base.Title, " : ", string.Join(", ", Tags));
			}
		}

		protected override void WriteChannel()
		{
			BuildChannel(BlogUrls.Instance().TagsBrowser(CurrentSection.ApplicationKey, Tags), Description, CurrentWeblog.DefaultLanguage);
		}


	}
}
